//
//  FileTree.h
//  syncer
//
//  Created by Silvtar on 11/28/12.
//  Copyright (c) 2012 Silvtar. All rights reserved.
//

#ifndef __syncer__FileTree__
#define __syncer__FileTree__

#include <iostream>
#include <vector>

const bool IGNORE_DOT = true;

class SSTree;

class SSTreeNode {
private:
	std::string name;
	std::string relativePath;
	bool isDir;
	long long int date;
	long long int size;
	std::vector<SSTreeNode> child;

public:
	friend class SSTree;
	//**************************get 方法*******************************
	inline std::string getName() const {
		return name;
	}
	inline std::string getRelativePath() const {
		return relativePath;
	}
	inline bool getIsDir() const {
		return isDir;
	}
	inline long long int getDate() const {
		return date;
	}
	inline long long int getSize() const {
		return size;
	}
	inline std::vector<SSTreeNode> getChild() const {
		return child;
	}
	//********************************构造***********************************
	SSTreeNode();
	//****************************重载运算符*********************************
	bool operator==(const SSTreeNode &t);
	//********************************其他***********************************
	void print();
	int transLocal(SSTree &source, SSTree &aim);	//拷贝自己到本地

};

class SSTree {
private:
	SSTreeNode root;
	std::string path;

public:
	friend class SSAnalyzer;
	inline std::string getPath() const {
		return path;
	}
	void printFileTree();			//显示文件树
	int build(std::string path);	//构建文件树
	int scanDirMain();				//开始扫描文件夹
	int scanDir(SSTreeNode &currentNode);		//扫描文件夹，递归
};

#endif /* defined(__syncer__FileTree__) */
